<?php
class ForComponent extends Component
{


function botones(){



$mktime=mktime(date('his'));
$carg=$mktime;

$atrib='cursor:pointer; border: 0;height:16px; color:gray;top:0; font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 0.8em;font-weight:bold;';
$atribhover='cursor:pointer; border: 0;height:18px; color:red;top:0;';
$class='x-btn-default-small x-noicon x-btn-noicon x-btn-default-small-noicon x-btn-center';
//class='x-toolbar-item x-btn-default-small x-focus x-btn-focus x-btn-default-small-focus x-over x-btn-over x-btn-default-small-over over';
$ruta='../../img/iconos/icons/botonesmicro/';


echo '
<style type="text/css">
#buttonnuevolayoutinput{'.$atrib.'background: url(\''.$ruta.'1364925873_document-new.png\') no-repeat;}
#buttonnuevolayoutinput:hover{'.$atribhover.';background: url(\''.$ruta.'1364925869_tests.png\') no-repeat;}

#buttonfiltrolayoutinput{'.$atrib.';background: url(\''.$ruta.'1364926098_old-edit-find.png\') no-repeat;}
#buttonfiltrolayoutinput:hover{'.$atribhover.'background: url(\''.$ruta.'1364926098_old-edit-find.png\') no-repeat;}

#buttonpdflayoutinput{'.$atrib.'background: url(\''.$ruta.'1364925864_pdf.png\') no-repeat;}
#buttonpdflayoutinput:hover{'.$atribhover.'background: url(\''.$ruta.'1364925860_ACP_PDF 2_file_document.png\') no-repeat;}

#buttonexellayoutinput{'.$atrib.'background: url(\''.$ruta.'1364925880_application-vnd.ms-excel.png\') no-repeat;}
#buttonexellayoutinput:hover{'.$atribhover.'background: url(\''.$ruta.'1364925880_application-vnd.ms-excel.png\') no-repeat;}

#buttoncallayoutinput{'.$atrib.'background: url(\''.$ruta.'1364925877_application-vnd.ms-word.png\') no-repeat;}
#buttoncallayoutinput:hover{'.$atribhover.'background: url(\''.$ruta.'1364925877_application-vnd.ms-word.png\') no-repeat;
</style>

';

echo '<script type="text/javascript">

document.getElementById("buttonnuevolayout").innerHTML = "<div class=\"'.$class.'\"><input id=\"buttonnuevolayoutinput\" type=\"button\" value=\"&nbsp;&nbsp;&nbsp;&nbsp;Nuevo\" onclick=\"'.$this->ajax('','TARJETAPRODUCTIVA/nuevo/buttonnuevolayout','vista').'\" /></div>";

</script>';
//<div onclick="<?=$this->For->ajax('','Usuarios/nuevo/nuevo1/'.$divlistado,$carg);? >">

echo '<script type="text/javascript">

document.getElementById("buttonfiltrolayout").innerHTML = "<div class=\"'.$class.'\"><input id=\"buttonfiltrolayoutinput\" type=\"button\" value=\"&nbsp;&nbsp;&nbsp;&nbsp;Filtro\" onclick=\"'.$this->ajax('','TARJETAPRODUCTIVA/listado2','tabs_1').'\" /></div>";


</script>';


echo '<script type="text/javascript">

document.getElementById("buttonpdflayout").innerHTML = "<div class=\"'.$class.'\"><input id=\"buttonpdflayoutinput\" type=\"button\" value=\"&nbsp;&nbsp;&nbsp;&nbsp;Pdf\" onclick=\"'.$this->ajax('','TARJETAPRODUCTIVA/listado2','tabs_1').'\"></div>";

</script>';


echo '<script type="text/javascript">

document.getElementById("buttonexellayout").innerHTML = "<div class=\"'.$class.'\"><input id=\"buttonexellayoutinput\" type=\"button\" value=\"&nbsp;&nbsp;&nbsp;&nbsp;Exel\" onclick=\"'.$this->ajax('','TARJETAPRODUCTIVA/listado2','tabs_1').'\"></div>";

</script>';

echo '<script type="text/javascript">

document.getElementById("buttoncallayout").innerHTML = "<div class=\"'.$class.'\"><input id=\"buttoncallayoutinput\" type=\"button\" value=\"&nbsp;&nbsp;&nbsp;&nbsp;Cal\" onclick=\"'.$this->ajax('','TARJETAPRODUCTIVA/listado2','tabs_1').'\"></div>";

</script>';

/*
echo '<script type="text/javascript">

document.getElementById("buttonpruebalayout").innerHTML = "<div class=\"'.$class.'\"><input id=\"buttoncallayoutinput\" type=\"button\" value=\"&nbsp;&nbsp;&nbsp;&nbsp;Prueba\" onclick=\"'.$this->ajax('','TARJETAPRODUCTIVA/listado2','tabs_1').'\"></div>";

</script>';

*/
}








function ajax($ayuda='vacio',$ruta=null,$update='div_error_evento',$array=null,$pre=null){
if($array!=null){
$valor="ajax('$ruta','$update','".implode(',', $array)."');";
}else{ 
$valor="ajax('$ruta','$update');";
}
/*
	if(isset($pre[0]) && isset($pre[1]))
	{
			$alert="<script type=\"text/javascript\">

Ext.onReady(function(){
    Ext.get(\"".$pre[0]."\").on(\"click\", function(e){
        Ext.MessageBox.confirm(\"Csssonfirmar\", \"".$pre[1]."\", mifuncion);
    });function mifuncion(btn){

if(btn==\"yes\"){".$valor."
}


};

});
</script>


";

	}
	else
	{
		$alert=$valor;
	}
*/
$alert=$valor;
return $alert;
}

function id($ayuda='vacio',$id) {
$id = base64_decode(base64_decode(base64_decode(base64_decode(base64_decode($id)))));
return $id; 
}



function decode($ayuda='vacio',$valor='null') {
//echo $valor;
if($valor!=null){
/*
	$decode=str_replace('"','',$valor);
	$decode=str_replace("'",'',$decode);
	$encode=str_replace(",",'',$decode);
	$decode=str_replace("-",'',$decode);
	$decode=str_replace("&",'',$decode);
	$decode=str_replace("<",'',$decode);
	$decode=str_replace(">",'',$decode);
	$decode=str_replace("%",'',$decode);
	$decode=str_replace("^",'',$decode);
	$encode=str_replace("/",'',$encode);
	$encode=str_replace("|",'',$encode);
	$encode=str_replace(":",'',$encode);
	$encode=str_replace("`",'',$encode);
	$encode=str_replace("[",'',$encode);
	$encode=str_replace("]",'',$encode);
	$encode=str_replace("{",'',$encode);
	$encode=str_replace("}",'',$encode);
	$encode=str_replace("(",'',$encode);
	$encode=str_replace(")",'',$encode);
	$encode=str_replace("=",'',$encode);
	$encode=str_replace(".",'',$encode);
	$encode=str_replace("~",'',$encode);
	$encode=str_replace("`",'',$encode);
*/
	$decode=$valor;
	@$decode=convert_uudecode($decode);
	@$decode=base64_decode($decode);
	$decode=str_replace("hidden",' ',$decode);
	$decode=str_replace("block:",' ',$decode);
	$decode=trim($decode);
	$valor=$decode;
//	echo "decodificado = ".$decode;

if(is_numeric($decode))
$valor=false;
else
$valor=true;
}
else
$valor=true;
return $valor;
}


    function mayuscula($t) {
        return trim(addslashes(strtr(strtoupper($t), "àèìòùáéíóúçñäëïöü", "ÀÈÌÒÙÁÉÍÓÚÇÑÄËÏÖÜ")));
    }
  
    function data($data) {
	$array=array();
	foreach ($data as $key => $value) {
	if($key!='id')
	$array[$key]=$this->mayuscula($value);
	else
	$array[$key]=$value;
	}
	return $array;
    }


}
